/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controlador;

import Modelo.Listas;
import Modelo.Rutas;
import Vista.JFrameRutas;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.text.SimpleDateFormat;
import java.util.Date;


public class ControladorRutas implements ActionListener,KeyListener
{
    JFrameRutas formRutas;
    Listas LisR;
    
    public ControladorRutas(Listas Lis) 
    {
      LisR=Lis;  
      formRutas=new JFrameRutas();  
      formRutas.agregarListener(this);
      formRutas.setVisible(true);
      
       //-------------------
        formRutas.getTxtCodigoR().addKeyListener(new KeyAdapter()
                
                   {        
                        public void keyTyped (KeyEvent e)
                          {     
                            CodigoRKeyTyped(e);  
                          }
                         
                       public void keyPressed(KeyEvent e) 
                       {
                         CodigoRKeyPressed(e);  
                       }      

            private void CodigoRKeyTyped(java.awt.event.KeyEvent evt)
                    
            {
              String Cadena;
              
      
                 Cadena=formRutas.getTxtCodigoR().getText();
                 if (Cadena.length()==10)
                 evt.consume();  
                    
             }

            private void CodigoRKeyPressed(KeyEvent e) 
    {
      
    } 
                         
  });
         
        
        
        
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void keyTyped(KeyEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void keyPressed(KeyEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void keyReleased(KeyEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
